Skip to main content

API Calling Convension

  • All APIs are accessed through HTTP and WebSocket, with the following required headers:
HeaderDescription
content-typeapplication/json
  • The request format is based on the following JSON data
{
"req": "<module.action>",
"arg": {<key>:<value>}
}

You can set arg data in the Request Body , or you can bring request parameters in the URL, that is, the following two methods are supported:

http://<ip>:<port>/api?req=<module.action>&arg={...}
http://<ip>:<port>/api?req=<module.action>

# <---request body--->
{
"<key>":"<value>"
}
  • The response would always be a JSON object with the following members:
ParameterDescription
rspmodule.action
retReturn data, when the response is successful, it is a json object or an array; when the response fails, it is a string, including an error description.
errError code when response fails

Sample response to a succeeded request:

{
"rsp": "<module.action>",
"ret": {...}
}

Sample response to a failed request:

{
   "rsp": "<module.action>",
   "err": <err_code>,
   "ret": "<error_explanation>"
}